<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ include file="/WEB-INF/jsp/common/header.jsp" %>

<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card shadow">
            <div class="card-header bg-primary text-white">
                <h4 class="mb-0">用户注册</h4>
            </div>
            <div class="card-body">
                <form action="${pageContext.request.contextPath}/user/register" method="post">
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="username" class="form-label">用户名 <span class="text-danger">*</span></label>
                            <input type="text" class="form-control" id="username" name="username" value="${user.username}" required>
                            <div class="form-text">用户名用于登录，必须唯一</div>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label for="password" class="form-label">密码 <span class="text-danger">*</span></label>
                            <input type="password" class="form-control" id="password" name="password" required>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="nickname" class="form-label">昵称</label>
                            <input type="text" class="form-control" id="nickname" name="nickname" value="${user.nickname}">
                            <div class="form-text">网站显示的名称</div>
                        </div>
                        <div class="col-md-6 mb-3">
                            <label for="fullName" class="form-label">姓名</label>
                            <input type="text" class="form-control" id="fullName" name="fullName" value="${user.fullName}">
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-4 mb-3">
                            <label for="age" class="form-label">年龄</label>
                            <input type="number" class="form-control" id="age" name="age" value="${user.age}" min="1" max="120">
                        </div>
                        <div class="col-md-8 mb-3">
                            <label class="form-label">性别</label>
                            <div class="mt-2">
                                <div class="form-check form-check-inline">
                                    <input class="form-check-input" type="radio" name="gender" id="gender-male" value="男" ${user.gender == '男' ? 'checked' : ''}>
                                    <label class="form-check-label" for="gender-male">男</label>
                                </div>
                                <div class="form-check form-check-inline">
                                    <input class="form-check-input" type="radio" name="gender" id="gender-female" value="女" ${user.gender == '女' ? 'checked' : ''}>
                                    <label class="form-check-label" for="gender-female">女</label>
                                </div>
                                <div class="form-check form-check-inline">
                                    <input class="form-check-input" type="radio" name="gender" id="gender-other" value="其他" ${user.gender == '其他' ? 'checked' : ''}>
                                    <label class="form-check-label" for="gender-other">其他</label>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6 mb-3">
                            <label for="email" class="form-label">电子邮箱</label>
                            <input type="email" class="form-control" id="email" name="email" value="${user.email}">
                        </div>
                        <div class="col-md-6 mb-3">
                            <label for="phone" class="form-label">手机号码</label>
                            <input type="tel" class="form-control" id="phone" name="phone" value="${user.phone}">
                        </div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="hobby" class="form-label">爱好</label>
                        <input type="text" class="form-control" id="hobby" name="hobby" value="${user.hobby}">
                        <div class="form-text">多个爱好请用逗号分隔，如：阅读,旅游,音乐</div>
                    </div>
                    
                    <div class="d-grid gap-2">
                        <button type="submit" class="btn btn-primary">注册</button>
                    </div>
                </form>
            </div>
            <div class="card-footer text-center">
                <p>已有账号？<a href="${pageContext.request.contextPath}/user/login">返回登录</a></p>
            </div>
        </div>
    </div>
</div>

<%@ include file="/WEB-INF/jsp/common/footer.jsp" %> 